﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;

using Tradex;
using Tradex.Market;
using Tradex.Trading;

namespace Tradex.Messages {
    
    /// <summary>
    /// An instrument update is exchanged to inform the other party of the existence of an instrument or changes to
    /// an instruments reference data, which comes in possily an InstrumentInfo and/or an InstrumentPricing class.
    /// It can come without payload, but this is less usefull.
    /// </summary>
    [Serializable()]
    public class InstrumentUpdateMessage : Message {

        /// <summary>
        /// Constructor taking all values.
        /// </summary>
        /// <param name="instrumentKey"></param>
        /// <param name="instrumentInfo"></param>
        /// <param name="instrumentPricing"></param>
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1026:DefaultParametersShouldNotBeUsed")]
        public InstrumentUpdateMessage (
            InstrumentKey instrumentKey,
            InstrumentInfo instrumentInfo = null,
            InstrumentPricing instrumentPricing = null
        ) {
            InstrumentKey = instrumentKey;
            InstrumentInfo = instrumentInfo;
            InstrumentPricing = instrumentPricing;
        }

        /// <inheritdoc />
        public override MessageCode Code { get { return MessageCode.InstrumentUpdate; } }

        /// <summary>
        /// Gets the InstrumentKey.
        /// </summary>
        public InstrumentKey InstrumentKey { get; private set; }

        /// <summary>
        /// Gets the InstrumentInfo.
        /// </summary>
        public InstrumentInfo InstrumentInfo { get; private set; }

        /// <summary>
        /// Gets the InstrumentPricing.
        /// </summary>
        public InstrumentPricing InstrumentPricing { get; private set; }
        
        /// <summary>
        /// Gets the Error, if one exists.
        /// </summary>
        public string Error { get; private set; }

    }
}
